home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / FixMath.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  2.9 KB  |  110 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        FixMath.h
  3.  
  4.      Contains:    Fixed Math Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __FIXMATH__
  21. #define __FIXMATH__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=mac68k
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT_SUPPORTED
  38. #pragma import on
  39. #endif
  40.  
  41. #define fixed1 ((Fixed) 0x00010000L)
  42. #define fract1 ((Fract) 0x40000000L)
  43. #define positiveInfinity ((long) 0x7FFFFFFFL)
  44. #define negativeInfinity ((long) 0x80000000L)
  45. extern pascal Fract Fix2Frac(Fixed x)
  46.  ONEWORDINLINE(0xA841);
  47. extern pascal long Fix2Long(Fixed x)
  48.  ONEWORDINLINE(0xA840);
  49. extern pascal Fixed Long2Fix(long x)
  50.  ONEWORDINLINE(0xA83F);
  51. extern pascal Fixed Frac2Fix(Fract x)
  52.  ONEWORDINLINE(0xA842);
  53. extern pascal Fract FracMul(Fract x, Fract y)
  54.  ONEWORDINLINE(0xA84A);
  55. extern pascal Fixed FixDiv(Fixed x, Fixed y)
  56.  ONEWORDINLINE(0xA84D);
  57. extern pascal Fract FracDiv(Fract x, Fract y)
  58.  ONEWORDINLINE(0xA84B);
  59. extern pascal Fract FracSqrt(Fract x)
  60.  ONEWORDINLINE(0xA849);
  61. extern pascal Fract FracSin(Fixed x)
  62.  ONEWORDINLINE(0xA848);
  63. extern pascal Fract FracCos(Fixed x)
  64.  ONEWORDINLINE(0xA847);
  65. extern pascal Fixed FixATan2(long x, long y)
  66.  ONEWORDINLINE(0xA818);
  67. #if GENERATINGPOWERPC
  68. extern short WideCompare(const wide *target, const wide *source);
  69. extern WidePtr WideAdd(wide *target, const wide *source);
  70. extern WidePtr WideSubtract(wide *target, const wide *source);
  71. extern WidePtr WideNegate(wide *target);
  72. extern WidePtr WideShift(wide *target, long shift);
  73. extern unsigned long WideSquareRoot(const wide *source);
  74. extern WidePtr WideMultiply(long multiplicand, long multiplier, wide *target);
  75. /* returns the quotient */
  76. extern long WideDivide(const wide *dividend, long divisor, long *remainder);
  77. /* quotient replaces dividend */
  78. extern WidePtr WideWideDivide(wide *dividend, long divisor, long *remainder);
  79. extern WidePtr WideBitShift(wide *src, long shift);
  80. #endif
  81. #if GENERATING68K && !GENERATING68881
  82. extern pascal double_t Frac2X(Fract x)
  83.  ONEWORDINLINE(0xA845);
  84. extern pascal double_t Fix2X(Fixed x)
  85.  ONEWORDINLINE(0xA843);
  86. extern pascal Fixed X2Fix(double_t x)
  87.  ONEWORDINLINE(0xA844);
  88. extern pascal Fract X2Frac(double_t x)
  89.  ONEWORDINLINE(0xA846);
  90. #else
  91. extern pascal double_t Frac2X(Fract x);
  92. extern pascal double_t Fix2X(Fixed x);
  93. extern pascal Fixed X2Fix(double_t x);
  94. extern pascal Fract X2Frac(double_t x);
  95. #endif
  96.  
  97. #if PRAGMA_IMPORT_SUPPORTED
  98. #pragma import off
  99. #endif
  100.  
  101. #if PRAGMA_ALIGN_SUPPORTED
  102. #pragma options align=reset
  103. #endif
  104.  
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108.  
  109. #endif /* __FIXMATH__ */
  110.